(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[51],{27:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var s=n(0),c=n(14),o=n.n(c);function r(e){const t=Object(s.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},295:function(e,t,n){"use strict";var s=n(0),c=n(4),o=n.n(c);n(296),t.a=({children:e,className:t,headingLevel:n,...c})=>{const r=o()("wc-block-components-title",t),i=`h${n}`;return Object(s.createElement)(i,{className:r,...c},e)}},296:function(e,t){},297:function(e,t){},298:function(e,t,n){"use strict";var s=n(1);t.a=({defaultTitle:e=Object(s.__)("Step","woocommerce"),defaultDescription:t=Object(s.__)("Step description text.","woocommerce"),defaultShowStepNumber:n=!0})=>({title:{type:"string",default:e},description:{type:"string",default:t},showStepNumber:{type:"boolean",default:n}})},303:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var s=n(5),c=n(3);const o=()=>{const{customerData:e,isInitialized:t}=Object(s.useSelect)((e=>{const t=e(c.CART_STORE_KEY);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}})),{setShippingAddress:n,setBillingAddress:o}=Object(s.useDispatch)(c.CART_STORE_KEY);return{isInitialized:t,billingAddress:e.billingAddress,shippingAddress:e.shippingAddress,setBillingAddress:o,setShippingAddress:n}}},315:function(e,t){},316:function(e,t){},317:function(e,t){},319:function(e,t,n){"use strict";var s=n(0),c=n(4),o=n.n(c),r=n(295);n(297);const i=({title:e,stepHeadingContent:t})=>Object(s.createElement)("div",{className:"wc-block-components-checkout-step__heading"},Object(s.createElement)(r.a,{"aria-hidden":"true",className:"wc-block-components-checkout-step__title",headingLevel:"2"},e),!!t&&Object(s.createElement)("span",{className:"wc-block-components-checkout-step__heading-content"},t));t.a=({id:e,className:t,title:n,legend:c,description:r,children:a,disabled:l=!1,showStepNumber:d=!0,stepHeadingContent:u=(()=>{})})=>{const p=c||n?"fieldset":"div";return Object(s.createElement)(p,{className:o()(t,"wc-block-components-checkout-step",{"wc-block-components-checkout-step--with-step-number":d,"wc-block-components-checkout-step--disabled":l}),id:e,disabled:l},!(!c&&!n)&&Object(s.createElement)("legend",{className:"screen-reader-text"},c||n),!!n&&Object(s.createElement)(i,{title:n,stepHeadingContent:u()}),Object(s.createElement)("div",{className:"wc-block-components-checkout-step__container"},!!r&&Object(s.createElement)("p",{className:"wc-block-components-checkout-step__description"},r),Object(s.createElement)("div",{className:"wc-block-components-checkout-step__content"},a)))}},386:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var s=n(2),c=n(0),o=n(5),r=n(3),i=n(303),a=n(93);const l=()=>{const{needsShipping:e}=Object(a.a)(),{useShippingAsBilling:t,prefersCollection:n}=Object(o.useSelect)((e=>({useShippingAsBilling:e(r.CHECKOUT_STORE_KEY).getUseShippingAsBilling(),prefersCollection:e(r.CHECKOUT_STORE_KEY).prefersCollection()}))),{__internalSetUseShippingAsBilling:l}=Object(o.useDispatch)(r.CHECKOUT_STORE_KEY),{billingAddress:d,setBillingAddress:u,shippingAddress:p,setShippingAddress:b}=Object(i.a)(),h=Object(c.useCallback)((e=>{u({email:e})}),[u]),g=Object(c.useCallback)((e=>{u({phone:e})}),[u]),m=Object(c.useCallback)((e=>{b({phone:e})}),[b]),O=Object(s.getSetting)("forcedBillingAddress",!1);return{shippingAddress:p,billingAddress:d,setShippingAddress:b,setBillingAddress:u,setEmail:h,setBillingPhone:g,setShippingPhone:m,defaultAddressFields:s.defaultAddressFields,useShippingAsBilling:t,setUseShippingAsBilling:l,needsShipping:e,showShippingFields:!O&&e&&!n,showShippingMethods:e&&!n,showBillingFields:!e||!t||n,forcedBillingAddress:O,useBillingAsShipping:O||n}}},390:function(e,t,n){"use strict";var s=n(0),c=n(47),o=n(44);const r=["BUTTON","FIELDSET","INPUT","OPTGROUP","OPTION","SELECT","TEXTAREA","A"];t.a=({children:e,style:t={},...n})=>{const i=Object(s.useRef)(null),a=()=>{i.current&&c.focus.focusable.find(i.current).forEach((e=>{r.includes(e.nodeName)&&e.setAttribute("tabindex","-1"),e.hasAttribute("contenteditable")&&e.setAttribute("contenteditable","false")}))},l=Object(o.b)(a,0,{leading:!0});return Object(s.useLayoutEffect)((()=>{let e;return a(),i.current&&(e=new window.MutationObserver(l),e.observe(i.current,{childList:!0,attributes:!0,subtree:!0})),()=>{e&&e.disconnect(),l.cancel()}}),[l]),Object(s.createElement)("div",{ref:i,"aria-disabled":"true",style:{userSelect:"none",pointerEvents:"none",cursor:"normal",...t},...n},e)}},391:function(e,t,n){"use strict";var s=n(0),c=n(1),o=n(12);t.a=({id:e="phone",errorId:t="phone",isRequired:n=!1,value:r="",onChange:i})=>Object(s.createElement)(o.ValidatedTextInput,{id:e,errorId:t,type:"tel",autoComplete:"tel",required:n,label:n?Object(c.__)("Phone","woocommerce"):Object(c.__)("Phone (optional)","woocommerce"),value:r,onChange:i})},392:function(e,t,n){"use strict";var s=n(0),c=n(12),o=n(30),r=n(1),i=n(23),a=n(4),l=n.n(a),d=n(11),u=n(418),p=n(20),b=n(5),h=n(3);n(316);var g=Object(d.withInstanceId)((({id:e,className:t,label:n,onChange:o,options:i,value:a,required:d=!1,errorMessage:g=Object(r.__)("Please select a value.","woocommerce"),errorId:m,instanceId:O="0",autoComplete:j="off"})=>{const f=Object(s.useRef)(null),E=e||"control-"+O,_=m||E,{setValidationErrors:k,clearValidationError:C}=Object(b.useDispatch)(h.VALIDATION_STORE_KEY),w=Object(b.useSelect)((e=>e(h.VALIDATION_STORE_KEY).getValidationError(_)));return Object(s.useEffect)((()=>(!d||a?C(_):k({[_]:{message:g,hidden:!0}}),()=>{C(_)})),[C,a,_,g,d,k]),Object(s.createElement)("div",{id:E,className:l()("wc-block-components-combobox",t,{"is-active":a,"has-error":(null==w?void 0:w.message)&&!(null!=w&&w.hidden)}),ref:f},Object(s.createElement)(u.a,{className:"wc-block-components-combobox-control",label:n,onChange:o,onFilterValueChange:e=>{if(e.length){const t=Object(p.a)(f.current)?f.current.ownerDocument.activeElement:void 0;if(t&&Object(p.a)(f.current)&&f.current.contains(t))return;const n=e.toLocaleUpperCase(),s=i.find((e=>e.label.toLocaleUpperCase().startsWith(n)||e.value.toLocaleUpperCase()===n));s&&o(s.value)}},options:i,value:a||"",allowReset:!1,autoComplete:j,"aria-invalid":(null==w?void 0:w.message)&&!(null!=w&&w.hidden)}),Object(s.createElement)(c.ValidationInputError,{propertyName:_}))}));n(315);var m=({className:e,countries:t,id:n,label:c,onChange:o,value:a="",autoComplete:d="off",required:u=!1,errorId:p,errorMessage:b=Object(r.__)("Please select a country","woocommerce")})=>{const h=Object(s.useMemo)((()=>Object.entries(t).map((([e,t])=>({value:e,label:Object(i.decodeEntities)(t)})))),[t]);return Object(s.createElement)("div",{className:l()(e,"wc-block-components-country-input")},Object(s.createElement)(g,{id:n,label:c,onChange:o,options:h,value:a,errorId:p,errorMessage:b,required:u,autoComplete:d}))},O=e=>Object(s.createElement)(m,{countries:o.i,...e}),j=e=>Object(s.createElement)(m,{countries:o.a,...e});n(317);const f=(e,t)=>{const n=t.find((t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return n?n.value:""};var E=({className:e,id:t,states:n,country:o,label:a,onChange:d,autoComplete:u="off",value:p="",required:b=!1,errorId:h=""})=>{const m=n[o],O=Object(s.useMemo)((()=>m?Object.keys(m).map((e=>({value:e,label:Object(i.decodeEntities)(m[e])}))):[]),[m]),j=Object(s.useCallback)((e=>{const t=O.length>0?f(e,O):e;t!==p&&d(t)}),[d,O,p]),E=Object(s.useRef)(p);return Object(s.useEffect)((()=>{E.current!==p&&(E.current=p)}),[p]),Object(s.useEffect)((()=>{if(O.length>0&&E.current){const e=f(E.current,O);e!==E.current&&j(e)}}),[O,j]),O.length>0?Object(s.createElement)(g,{className:l()(e,"wc-block-components-state-input"),id:t,label:a,onChange:j,options:O,value:p,errorMessage:Object(r.__)("Please select a state.","woocommerce"),errorId:h,required:b,autoComplete:u}):Object(s.createElement)(c.ValidatedTextInput,{className:e,id:t,label:a,onChange:j,autoComplete:u,value:p,required:b})},_=e=>Object(s.createElement)(E,{states:o.j,...e}),k=e=>Object(s.createElement)(E,{states:o.b,...e}),C=n(27),w=n(2),v=n(14),y=n.n(v),A=n(84);const S=Object.keys(w.defaultAddressFields);t.a=Object(d.withInstanceId)((({id:e="",fields:t=S,fieldConfig:n={},instanceId:o,onChange:i,type:a="shipping",values:l})=>{const d=Object(C.a)(t),u=Object(C.a)(n),p=Object(C.a)(l.country),g=Object(s.useMemo)((()=>{const e=Object(A.a)(d,u,p);return{fields:e,type:a,required:e.filter((e=>e.required)),hidden:e.filter((e=>e.hidden))}}),[d,u,p,a]),m=Object(s.useRef)({});return Object(s.useEffect)((()=>{const e={...l,...Object.fromEntries(g.hidden.map((e=>[e.key,""])))};y()(l,e)||i(e)}),[i,g,l]),Object(s.useEffect)((()=>{"shipping"===a&&(e=>{const t="shipping_country",n=Object(b.select)(h.VALIDATION_STORE_KEY).getValidationError(t);!e.country&&(e.city||e.state||e.postcode)&&(n?Object(b.dispatch)(h.VALIDATION_STORE_KEY).showValidationError(t):Object(b.dispatch)(h.VALIDATION_STORE_KEY).setValidationErrors({[t]:{message:Object(r.__)("Please select your country","woocommerce"),hidden:!1}})),n&&e.country&&Object(b.dispatch)(h.VALIDATION_STORE_KEY).clearValidationError(t)})(l)}),[l,a]),Object(s.useEffect)((()=>{var e,t;null===(e=m.current)||void 0===e||null===(t=e.postcode)||void 0===t||t.revalidate()}),[p]),e=e||o,Object(s.createElement)("div",{id:e,className:"wc-block-components-address-form"},g.fields.map((t=>{if(t.hidden)return null;const n={id:`${e}-${t.key}`,errorId:`${a}_${t.key}`,label:t.required?t.label:t.optionalLabel,autoCapitalize:t.autocapitalize,autoComplete:t.autocomplete,errorMessage:t.errorMessage,required:t.required,className:`wc-block-components-address-form__${t.key}`};if("country"===t.key){const e="shipping"===a?O:j;return Object(s.createElement)(e,{key:t.key,...n,value:l.country,onChange:e=>{const t={...l,country:e,state:""};l.postcode&&!Object(c.isPostcode)({postcode:l.postcode,country:e})&&(t.postcode=""),i(t)}})}if("state"===t.key){const e="shipping"===a?_:k;return Object(s.createElement)(e,{key:t.key,...n,country:l.country,value:l.state,onChange:e=>i({...l,state:e})})}return Object(s.createElement)(c.ValidatedTextInput,{key:t.key,ref:e=>m.current[t.key]=e,...n,value:l[t.key],onChange:e=>i({...l,[t.key]:e}),customFormatter:e=>"postcode"===t.key?e.trimStart().toUpperCase():e,customValidation:e=>((e,t,n)=>!((e.required||e.value)&&"postcode"===t&&n.country&&!Object(c.isPostcode)({postcode:e.value,country:n.country})&&(e.setCustomValidity(Object(r.__)("Please enter a valid postcode","woocommerce")),1)))(e,t.key,l)})})))}))},514:function(e,t,n){"use strict";n.r(t);var s=n(0),c=n(4),o=n.n(c),r=n(145),i=n(319),a=n(386),l=n(5),d=n(3),u=n(1),p=n(392),b=n(73),h=n(58),g=n(37),m=n(12),O=n(390),j=n(391),f=({showCompanyField:e=!1,showApartmentField:t=!1,showPhoneField:n=!1,requireCompanyField:c=!1,requirePhoneField:o=!1})=>{const{defaultAddressFields:r,setShippingAddress:i,setBillingAddress:l,shippingAddress:d,billingAddress:f,setShippingPhone:E,useShippingAsBilling:_,setUseShippingAsBilling:k}=Object(a.a)(),{dispatchCheckoutEvent:C}=Object(b.a)(),{isEditor:w}=Object(h.a)(),{email:v}=f,[y,A]=Object(s.useState)(!1);Object(s.useEffect)((()=>{n||E("")}),[n,E]),Object(s.useEffect)((()=>{y||(_&&l({...d,email:v}),A(!0))}),[y,l,d,_]);const S=Object(s.useMemo)((()=>({company:{hidden:!e,required:c},address_2:{hidden:!t}})),[e,c,t]),N=Object(s.useCallback)((e=>{i(e),_&&(l({...e,email:v}),C("set-billing-address")),C("set-shipping-address")}),[C,v,l,i,_]),I=w?O.a:s.Fragment,T=_?[g.d.SHIPPING_ADDRESS,g.d.BILLING_ADDRESS]:[g.d.SHIPPING_ADDRESS];return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(I,null,Object(s.createElement)(m.StoreNoticesContainer,{context:T}),Object(s.createElement)(p.a,{id:"shipping",type:"shipping",onChange:N,values:d,fields:Object.keys(r),fieldConfig:S}),n&&Object(s.createElement)(j.a,{id:"shipping-phone",errorId:"shipping_phone",isRequired:o,value:d.phone,onChange:e=>{E(e),C("set-phone-number",{step:"shipping"})}})),Object(s.createElement)(m.CheckboxControl,{className:"wc-block-checkout__use-address-for-billing",label:Object(u.__)("Use same address for billing","woocommerce"),checked:_,onChange:e=>{k(e),e&&l(d)}}))},E=n(298),_={...Object(E.a)({defaultTitle:Object(u.__)("Shipping address","woocommerce"),defaultDescription:Object(u.__)("Enter the address where you want your order delivered.","woocommerce")}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},k=n(155);t.default=Object(r.withFilteredAttributes)(_)((({title:e,description:t,showStepNumber:n,children:c,className:r})=>{const u=Object(l.useSelect)((e=>e(d.CHECKOUT_STORE_KEY).isProcessing())),{showShippingFields:p}=Object(a.a)(),{requireCompanyField:b,requirePhoneField:h,showApartmentField:g,showCompanyField:m,showPhoneField:O}=Object(k.b)();return p?Object(s.createElement)(i.a,{id:"shipping-fields",disabled:u,className:o()("wc-block-checkout__shipping-fields",r),title:e,description:t,showStepNumber:n},Object(s.createElement)(f,{requireCompanyField:b,requirePhoneField:h,showApartmentField:g,showCompanyField:m,showPhoneField:O}),c):null}))}}]);